home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Kant Generator Pro 1.2 / src / Shell ƒ / window layer.h < prev   
Text File  |  1995-02-11  |  7KB  |  138 lines

  1. #if 0
  2.  
  3. Usage notes:
  4. - MyNewWindow or MyNewCWindow with all the standard parameters to create a
  5.   new window in the document layer.
  6. - MyNewFloatWindow or MyNewCFloatWindow with all the standard parameters to
  7.   create a new window in the floating layer.
  8. - MySelectWindow(theWindowPtr) to select a window in any layer
  9. - MyDisposeWindow(theWindowPtr) to dispose of a window in any layer
  10.  
  11. - Call InitTheWindowLayer(void) once at program startup before creating any
  12.   windows in any layer.
  13. - New windows are automatically visible and frontmost in their layer.  Storage
  14.   must be allocated (sizeof(ExtendedWindowRec)) and passed to any window creation
  15.   routine.
  16. - You should only dispose of the frontmost window in a layer.
  17.  
  18. #endif
  19.  
  20.  
  21. #ifndef __WINDOW_LAYER_H__
  22. #define __WINDOW_LAYER_H__
  23.  
  24. typedef struct
  25. {
  26.     WindowRecord    docWindow;                /* window record */
  27.     unsigned long    magic;                    /* magic number to see if window is ours */
  28.     short            layer;                    /* layer number */
  29.     WindowPtr        nextWindow;                /* next window in layer (further from front) */
  30.     WindowPtr        previousWindow;            /* previous window in layer (closer to front) */
  31.     short            windowIndex;            /* index of window in program's window list */
  32.     short            windowWidth;            /* width of window content, in pixels */
  33.     short            windowHeight;            /* height of window content, in pixels */
  34.     short            windowType;                /* type of window */
  35.     short            windowDepth;            /* current pixel depth of window */
  36.     short            maxDepth;                /* maximum pixel depth of window */
  37.     Boolean            hasCloseBox;            /* window has a close box */
  38.     Boolean            autoCenter;                /* auto center window in main screen when opened */
  39.     Boolean            isFloat;                /* is floating window? */
  40.     Boolean            modified;
  41.     Point            initialTopLeft;            /* initial window bounds when opened */
  42.     Rect            windowBounds;            /* on screen rectangle of window content */
  43.     ControlHandle    vScroll;                /* window's vertical scroll bar */
  44.     ControlHandle    hScroll;                /* window's horizontal scroll bar */
  45.     TEHandle        hTE;                    /* window's TextEdit handle */
  46.     Str63            title;                    /* window title */
  47.     FSSpec            fs;
  48.     RgnHandle        hiliteRgn;
  49.     TEClickLoopUPP    oldClickLoopProc;
  50.     Boolean            draggable;
  51.     Boolean            active;
  52.     short            lastFindPosition;
  53.     Boolean            drawGrowIconLines;
  54.     Boolean            isPrintable;
  55. } ExtendedWindowRec, *ExtendedWindowPtr;
  56.  
  57. #define GetWindowIndex(w)                (((ExtendedWindowPtr)w)->windowIndex)
  58. #define GetWindowWidth(w)                (((ExtendedWindowPtr)w)->windowWidth)
  59. #define GetWindowHeight(w)                (((ExtendedWindowPtr)w)->windowHeight)
  60. #define GetWindowType(w)                (((ExtendedWindowPtr)w)->windowType)
  61. #define GetWindowDepth(w)                (((ExtendedWindowPtr)w)->windowDepth)
  62. #define GetWindowMaxDepth(w)            (((ExtendedWindowPtr)w)->maxDepth)
  63. #define WindowHasCloseBoxQQ(w)            (((ExtendedWindowPtr)w)->hasCloseBox)
  64. #define WindowAutoCenterQQ(w)            (((ExtendedWindowPtr)w)->autoCenter)
  65. #define WindowIsFloatQQ(w)                (((ExtendedWindowPtr)w)->isFloat)
  66. #define WindowIsModifiedQQ(w)            (((ExtendedWindowPtr)w)->modified)
  67. #define GetWindowTopLeft(w)                (((ExtendedWindowPtr)w)->initialTopLeft)
  68. #define GetWindowBounds(w)                (((ExtendedWindowPtr)w)->windowBounds)
  69. #define GetWindowVScrollBar(w)            (((ExtendedWindowPtr)w)->vScroll)
  70. #define GetWindowHScrollBar(w)            (((ExtendedWindowPtr)w)->hScroll)
  71. #define GetWindowTE(w)                    (((ExtendedWindowPtr)w)->hTE)
  72. #define GetWindowTitle(w)                (((ExtendedWindowPtr)w)->title)
  73. #define GetWindowFS(w)                    (((ExtendedWindowPtr)w)->fs)
  74. #define GetWindowHiliteRgn(w)            (((ExtendedWindowPtr)w)->hiliteRgn)
  75. #define GetWindowOldClickLoopProc(w)    (((ExtendedWindowPtr)w)->oldClickLoopProc)
  76. #define WindowIsDraggableQQ(w)            (((ExtendedWindowPtr)w)->draggable)
  77. #define WindowIsActiveQQ(w)                (((ExtendedWindowPtr)w)->active)
  78. #define GetWindowLastFindPosition(w)    (((ExtendedWindowPtr)w)->lastFindPosition)
  79. #define WindowDrawGrowIconLinesQQ(w)    (((ExtendedWindowPtr)w)->drawGrowIconLines)
  80. #define WindowIsPrintableQQ(w)            (((ExtendedWindowPtr)w)->isPrintable)
  81.  
  82. #define SetWindowIndex(w,x)                { ((ExtendedWindowPtr)w)->windowIndex=x; }
  83. #define SetWindowWidth(w,x)                { ((ExtendedWindowPtr)w)->windowWidth=x; }
  84. #define SetWindowHeight(w,x)            { ((ExtendedWindowPtr)w)->windowHeight=x; }
  85. #define SetWindowType(w,x)                { ((ExtendedWindowPtr)w)->windowType=x; }
  86. #define SetWindowDepth(w,x)                { ((ExtendedWindowPtr)w)->windowDepth=x; }
  87. #define SetWindowMaxDepth(w,x)            { ((ExtendedWindowPtr)w)->maxDepth=x; }
  88. #define SetWindowHasCloseBox(w,x)        { ((ExtendedWindowPtr)w)->hasCloseBox=x; }
  89. #define SetWindowAutoCenter(w,x)        { ((ExtendedWindowPtr)w)->autoCenter=x; }
  90. #define SetWindowIsFloat(w,x)            { ((ExtendedWindowPtr)w)->isFloat=x; }
  91. #define SetWindowIsModified(w,x)        { ((ExtendedWindowPtr)w)->modified=x; }
  92. #define SetWindowTopLeft(w,x)            { ((ExtendedWindowPtr)w)->initialTopLeft=x; }
  93. #define SetWindowBounds(w,x)            { ((ExtendedWindowPtr)w)->windowBounds=x; }
  94. #define SetWindowVScrollBar(w,x)        { ((ExtendedWindowPtr)w)->vScroll=x; }
  95. #define SetWindowHScrollBar(w,x)        { ((ExtendedWindowPtr)w)->hScroll=x; }
  96. #define SetWindowTE(w,x)                { ((ExtendedWindowPtr)w)->hTE=x; }
  97. #define SetWindowTitle(w,x)                { BlockMove(x, (((ExtendedWindowPtr)w)->title), x[0]+1); }
  98. #define SetWindowFS(w,x)                { ((ExtendedWindowPtr)w)->fs=x; }
  99. #define SetWindowHiliteRgn(w,x)            { ((ExtendedWindowPtr)w)->hiliteRgn=x; }
  100. #define SetWindowOldClickLoopProc(w,x)    { ((ExtendedWindowPtr)w)->oldClickLoopProc=x; }
  101. #define SetWindowIsDraggable(w,x)        { ((ExtendedWindowPtr)w)->draggable=x; }
  102. #define SetWindowIsActive(w,x)            { ((ExtendedWindowPtr)w)->active=x; }
  103. #define SetWindowLastFindPosition(w,x)    { ((ExtendedWindowPtr)w)->lastFindPosition=x; }
  104. #define SetWindowDrawGrowIconLines(w,x)    { ((ExtendedWindowPtr)w)->drawGrowIconLines=x; };
  105. #define SetWindowIsPrintable(w,x)        { ((ExtendedWindowPtr)w)->isPrintable=x; }
  106.  
  107. #define IndWindowExistsQQ(x)        (GetIndWindowPtr(x)!=0L)
  108. #define WindowExistsQQ(w)            (w!=0L)
  109. #define FrontDocumentWindow()        GetFrontDocumentWindow()
  110.  
  111. extern    Boolean            gIgnoreNextActivateEvent;
  112.  
  113. /* necessary routines */
  114. void InitTheWindowLayer(void);
  115. void ShutDownTheWindowLayer(void);
  116. WindowPtr MyNewWindow(void *wStorage, const Rect *boundsRect, ConstStr255Param title,
  117.     Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon);
  118. WindowPtr MyNewCWindow(void *wStorage, const Rect *boundsRect, ConstStr255Param title,
  119.     Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon);
  120. WindowPtr MyNewFloatWindow(void *wStorage, const Rect *boundsRect, ConstStr255Param title,
  121.     Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon);
  122. WindowPtr MyNewFloatCWindow(void *wStorage, const Rect *boundsRect, ConstStr255Param title,
  123.     Boolean visible, short procID, WindowPtr behind, Boolean goAwayFlag, long refCon);
  124. void MyDisposeWindow(WindowPtr window);
  125. Boolean MySelectWindow(WindowPtr window);
  126.  
  127. /* useful abstract routines for working with windows */
  128. Boolean WindowHasLayer(WindowPtr window);
  129. Boolean WindowIsFloat(WindowPtr window);
  130. WindowPtr GetFrontDocumentWindow(void);
  131. WindowPtr GetIndWindowPtr(short index);
  132.  
  133. /* useful patches */
  134. void InstallHilitePatch(void);
  135. void RemoveHilitePatch(void);
  136.  
  137. #endif
  138.